1. Field of the Invention
The present invention relates generally to a graphics system for a personal computer. More particularly, the present invention relates to a method and apparatus for applying specular highlighting to pixels on a computer display. Still more particularly, the present invention relates to an improved method of applying specular highlighting with specular components included with texture maps.
2. Background of the Invention
Sophisticated graphics packages have been used for some time in expensive computer aided drafting, design and simulation systems. Increased capabilities of graphic controllers and display systems, combined with standardized graphics languages, have made complex graphics functions available in even the most routine applications. For example, word processors, spread sheets and desktop publishing packages now include relatively sophisticated graphics capabilities. Three-dimensional (3D) displays have become common in games, animation, and multimedia communication and drawing packages.
The availability of sophisticated graphics in PC's has driven a demand for even greater graphic capabilities. To obtain these capabilities, graphic systems must be capable of performing more sophisticated functions in less time to process greater amounts of graphical data required by modern software applications. In particular, there is a continuing need for improvements in software algorithms and hardware implementations to draw three-dimensional objects using full color, shading, texture mapping, and transparency blending.
The development of raster display systems has dramatically reduced the overall cost and increased the capabilities of graphic systems. In a raster display system, a set of orthogonal or horizontal scan lines, each comprising a row of pixels, forms an array or grid of pixels to represent the entire screen area. The screen preferably comprises a cathode ray tube (CRT), LCD display, or the like, capable of scanning the entire pixel grid at a relatively high rate to reduce flicker. The pixel data preferably is stored in a frame buffer comprising dynamic random access memories (DRAMs), or more preferably video RAM's (VRAMs), where each pixel is represented by one or more bits depending upon the desired resolution In many graphics systems, for example, each pixel is drawn or "rendered" with 24 bits of color information (8 bits for red, 8 bits for green, 8 bits for blue). Typical display systems are capable of drawing screens with multiple colors at a variety of screen resolutions, including resolutions of 640 pixels.times.480 pixels, 800.times.600, 1024.times.768, 1280.times.1024, or even higher pixel value combinations, depending upon the software drivers and the hardware used.
Typically, a video controller scans and converts the pixel data in the frame buffer to provide control signals for the screen system. In particular, the video controller renders the screen pixels, typically from the top of the screen to the bottom and from left to right, converting pixel data into color intensity values for each pixel. In a color graphics system using a CRT, three separate beams are controlled for each of the primary colors, where the intensity of each of the beams is determined by the pixel value corresponding to the respective colors. A similar system is used for LCD displays.
Other improvements have been made in the hardware realm. Graphics processors and accelerators are available with software drivers that interface the host central processing unit (CPU) to the graphics processor. In general, objects to be drawn on the screen are represented by one or more polygons. Each polygon is further represented by one or more triangles. The software driver receives information for drawing the triangles on the screen, calculates certain basic parameters associated with the triangles and provides these parameters to the graphics processor. The software driver then sends a command for the graphics processor to draw the triangle into the frame buffer. A graphics processor may use interpolation techniques in which the fundamental information for the triangle to be drawn comprises a set of initial and incremental parameters. The graphics processor loads or otherwise receives the initial parameters for rendering a first pixel, and then interpolates the remaining pixels in a triangle by using the incremented parameters until the triangle is complete.
Graphics processors, such as the GD5464 manufactured by Cirrus Logic, are capable of applying texture to polygons through a process referred to as texture mapping. Texture mapping techniques generally apply a bitmap texture image to a polygon on the screen. A texture map typically is a two dimensional array of texture elements ("texels") that define a texture such as a brick, a carpet design, the grain of wood or any other texture that might be applied to an object on a computer screen.
In addition to texture, a graphics processor may apply glare, or specular highlight, to an object. In FIG. 1, for example, the front wall 20 of a jail cell includes numerous vertical bars 22 and one or more horizontal bars 24, as well as a door 21. Each bar typically is drawn to give the appearance of metal. To enhance the realism of the metallic surface of the bars 22, the bars are drawn to create the appearance of light reflecting off the bars by adding a specular component to the texel color values of the bars. The resulting appearance is that of "glare" from the surface of the metal bars. Many graphics processors create specular highlighting by adding a white color component, or some other appropriate color, to tem texel value to be applied to pixels on bars 22, 24. Further, the amount of specular highlighting can be varied by varying the intensity of the specular component applied to a particular texel value.
The glare created by light reflecting off of the surface of a physical object is, at least in part a function of the type of material comprising the object. For instance, a metal object results in more glare than a dark wood surface or even a metal surface that is covered with dirt. To provide a more realistic appearance of the surface of an object on which light is reflected in a computer system, the computer's graphics system should apply specular highlighting to the pixels of an object taking into account the type of texture applied to the surface of the object. Generally, a larger specular component should be applied to a polygon on which a texture map representing a glossy, metallic surface is applied than if the object's texture map represented a surface that reflects light poorly.
It thus would be beneficial to have a computer graphics system that can apply specular highlighting to pixels based on the type of texture applied to the pixels. Such a graphics system should be able to adjust the amount of specular highlighting applied to an object on the computer display depending on the particular texture map applied to the object. A graphics system that incorporates such a feature would increase the realism of the appearance of the displayed object. Despite the advantages such a system would offer, no graphics system that solves this problem is known to exist.